<template>
  <div>
    <h1>使用自定义类过渡动画</h1>
    <button @click="isshow = !isshow">点击吧</button>
    <transition name="move">
      <p v-show="isshow">hello</p>
      <!-- <span v-show="isshow">来不来</span> -->
    </transition>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isshow: false,
    };
  },
};
</script>

<style lang="less" scoped>
p {
  text-align: center;
  width: 200px;
  background-color: orange;
}
span {
  text-align: center;
  width: 100px;
  background-color: hotpink;
}
// 准备进入
.move-enter {
  margin-left: 250px;
  opacity: 0;
}
// 进入的过程
.move-enter-active {
  transition: all 2s;
}
// 进入完毕
.move-enter-to {
  margin-left: 0;
  opacity: 1;
}
// 准备离开
.move-leave {
  margin-left: 0;
  opacity: 1;
}
// 离开的过程
.move-leave-active {
  transition: all 1s;
}
// 离开完毕
.move-leave-to {
  margin-left: 250px;
  opacity: 0;
}
</style>

